
*load data
use "${PilotPublicData}/hgopy_followup_public.dta", clear

*drop if view == 0
bys view: tab adopted_method using_at16_method_16w , row missing

*create mat - LARC and SARC
recode using_at16_method_16w  (0 = 0 "Neither") (1 2 = 1 "LARC") (3 4 = 2 "SARC"), ///
  gen(using_at16_method_mat) label(matcontra)
recode adopted_method (0 = 0 "Neither") (1 2 = 1 "LARC") (3 4 = 2 "SARC"), ///
  gen(adopted_method_mat) label(matcontra)
label var using_at16_method_mat "Method at 16 week follow-up survey"
label var adopted_method_mat    "Adopted method during counselling"

*table example  
tab adopted_method_mat using_at16_method_mat, row 

tabout adopted_method_mat using_at16_method_mat using "${OutTexTab}/TabS7-adoption-matrix-complete.tex", /// 
  c(freq row) format(0c 1) clab(N %) cl2(2-3 4-5 6-7 8-9) h1(nil)     ///
  style(tex) replace                                                  ///
  topstr( m{0.125\textwidth}*{8}{>{\centering\arraybackslash}p{0.075\textwidth}} )  

